package com.yu.controller.login;

import com.yu.common.feign.FeignProviderClient;
import com.yu.config.result.BackResult;
import com.yu.config.result.BasePageResult;
import com.yu.domain.loginUser.param.UserParam;
import com.yu.domain.loginUser.vo.UserVo;
import com.yu.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@Api("登录接口")
@RestController
@RequestMapping("/api/login")
public class LoginController {


    @Autowired
    private UserService userService;
    @Autowired
    private FeignProviderClient feignProviderClient;

    @ApiOperation("用户信息接口")
    @GetMapping("/wnPage")
    public BackResult login(UserParam param) {
        BasePageResult basePageResult = userService.pageList(param);
        return BackResult.ok(basePageResult);
    }

    @ApiOperation("添加用户接口")
    @GetMapping("/addUser")
    public BackResult login(UserVo param) {
        BackResult basePageResult = userService.addTransactional(param);
        return BackResult.ok(basePageResult);
    }

//    @ApiOperation("测试")
//    @GetMapping("/test")
//    public BackResult test() {
//        BackResult list = feignProviderClient.attributeAll("A23A1101401");
//        return BackResult.ok(list);
//    }

    public static void main(String[] args) {
        Map map = new HashMap();
        map.put("id","2");
        map.putIfAbsent("id","1");
        System.out.println(map.get("id"));
    }


}
